package extended

import "jvmgo/ch08/instructions/base"
import "jvmgo/ch08/rtda"

// if ref == null
type IFNULL struct {
    base.BranchInstruction
}

func (self *IFNULL) Execute(frame *rtda.Frame) {
    ref := frame.OperandStack().PopRef()
    if ref == nil {
        base.Branch(frame, self.Offset)
    }
}

// if ref != null
type IFNONNULL struct {
    base.BranchInstruction
}

func (self *IFNONNULL) Execute(frame *rtda.Frame) {
    ref := frame.OperandStack().PopRef()
    if ref != nil {
        base.Branch(frame, self.Offset)
    }
}
